package com.llg.controller;

import com.llg.model.response.DataResult;
import com.llg.model.response.PageResult;
import com.llg.model.response.ResponseResult;
import com.llg.pojo.SendSpec;
import com.llg.service.SendSpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sendSpec")
public class SendSpecController {
    @Autowired
    private SendSpecService service;

    //通过品牌id查询所有发送卡
    @GetMapping("/findByBid")
    public PageResult<SendSpec> findByBId(Integer bid){
        return service.findByBId(bid);
    }

    //搜索并分页查询
    @PostMapping("/findList")
    public PageResult<SendSpec> findList(Integer currentPage,Integer pageSize,@RequestBody SendSpec sendSpec){
        return service.findList(currentPage, pageSize, sendSpec);
    }

    //通过id查
    @GetMapping("/{id}")
    public DataResult<SendSpec> findById(@PathVariable Integer id){
        return service.findById(id);
    }

    //增
    @PostMapping("/add")
    public DataResult<SendSpec> add(@RequestBody SendSpec sendSpec){
        return service.add(sendSpec);
    }

    //删
    @GetMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return service.delete(id);
    }

    //该
    @PostMapping("/update")
    public ResponseResult update(@RequestBody SendSpec sendSpec){
        return service.update(sendSpec);

    }
}
